Update base code to not rely on undefined overflow behaviour
authorJustin Chadwell <[email protected]>
Wed, 3 Jul 2019 13:15:22 +0000 (14:15 +0100)
committerJustin Chadwell <[email protected]>
Fri, 12 Jul 2019 08:12:19 +0000 (09:12 +0100)
This consists of ensuring that the left operand of each shift is
unsigned when the operation might overflow into the sign bit.

Change-Id: Iddd6f38139a4c6e500468b4fc48d04e0939f574e
Signed-off-by: Justin Chadwell <[email protected]>
include/drivers/ufs.h
lib/xlat_tables/aarch32/nonlpae_tables.c

index a10cd8034122ad82be6fd3f901d90ec6de915927..574c4ea0a5b1680452344f3c2ccbd8e686a3f8a9 100644 (file)
@@ -82,7 +82,7 @@
 #define UECDME                         0x48
 /* UTP Transfer Request Interrupt Aggregation Control Register */
 #define UTRIACR                                0x4C
-#define UTRIACR_IAEN                   (1 << 31)
+#define UTRIACR_IAEN                   (1U << 31)
 #define UTRIACR_IAPWEN                 (1 << 24)
 #define UTRIACR_IASB                   (1 << 20)
 #define UTRIACR_CTR                    (1 << 16)
index eca3be3fc7a496220764af3baecc79cbd0f87444..e31f9d8404cf11b5c9ee4e0b468e496c0bf94a50 100644 (file)
@@ -122,8 +122,8 @@ CASSERT(PLAT_PHY_ADDR_SPACE_SIZE == (1ULL << 32), invalid_paddr_space_size);
 #define DACR_DOMAIN_PERM_CLIENT                0x1
 #define DACR_DOMAIN_PERM_MANAGER       0x3
 
-#define NUM_1MB_IN_4GB         (1 << 12)
-#define NUM_4K_IN_1MB          (1 << 8)
+#define NUM_1MB_IN_4GB         (1U << 12)
+#define NUM_4K_IN_1MB          (1U << 8)
 
 #define ONE_MB_SHIFT           20